<template>
  <div class="wfm top x zb h60px nbx">
    <img src="favicon.ico" alt class="logo" />
    <el-menu
      :default-active="activeIndex2"
      class="el-menu-demo"
      mode="horizontal"
      @select="handleSelect"
      background-color="#545c64"
      text-color="#fff"
      active-text-color="#ffd04b"
    >
      <el-submenu index="1">
        <template slot="title">基本信息</template>
        <!-- <el-menu-item index="unit">计量单位</el-menu-item> -->
        <el-menu-item index="itemType">物料信息</el-menu-item>
        <el-menu-item index="userType">部门职员</el-menu-item>
        <el-menu-item index="depository">仓储信息</el-menu-item>
        <el-menu-item index="process">工序管理</el-menu-item>
        <el-menu-item index="project">项目管理</el-menu-item>
      </el-submenu>
      <el-submenu index="2">
        <template slot="title">我的工作台</template>
        <el-menu-item index="in/0">入库单</el-menu-item>
        <el-menu-item index="out/0">出库单</el-menu-item>
        <el-menu-item index="io/0">库存调整单</el-menu-item>
        <el-menu-item index="query">账目明细</el-menu-item>
      </el-submenu>
      <!-- <el-menu-item index="3">系统设置</el-menu-item> -->
      <el-menu-item index="exit">退出登录</el-menu-item>
    </el-menu>
  </div>
</template>

<script>
export default {
  data() {
    return {
      activeIndex2: sessionStorage.page
    };
  },
  methods: {
    handleSelect(key) {
      let path = "/admin/" + key;
      if (key == "exit") path = "/login";
      sessionStorage.setItem("page", key);
      if (this.$route.path != path) this.$router.push(path);
    }
  },
  created() {}
};
</script>

<style scoped>
.logo {
  height: 100%;
}
.top {
  background-color: rgb(51, 51, 51);
}
</style>